package com.glq.book.test;

import com.glq.book.dao.BookDao;
import com.glq.book.dao.BorrowDao;
import com.glq.book.dao.OrderDao;
import com.glq.book.dao.UserDao;
import com.glq.book.entity.Book;
import com.glq.book.entity.Borrow;
import com.glq.book.entity.Order;
import com.glq.book.entity.User;
import com.glq.book.vo.LoginVO;

import java.util.List;

public class Main {
    public static void main(String[] args) {
        BookDao bookDao = new BookDao();
        List<Book> list = bookDao.selectBookList();
        Book book = bookDao.selectBookById(1);
        Book newBook = new Book();
        newBook.setBookName("西游记");
        newBook.setBookNumber(100);
        newBook.setBookPrice(85);
        newBook.setBookType("名著");

//        System.out.println(bookDao.insertBook(newBook));
//        System.out.println(bookDao.subBookNumber(1,1));
//        System.out.println(bookDao.addBookNumber(1,1));
//        System.out.println(bookDao.deleteBook(2));
//        System.out.println(bookDao.updateBook(99, 1));
//        System.out.println(book);

//        BorrowDao borrowDao = new BorrowDao();
//        Borrow borrow = new Borrow();
//        borrow.setBookName("三国演义");
//        borrow.setUsername("admin");
//        System.out.println(borrowDao.insertBorrow(borrow));
//        System.out.println(borrowDao.updateBorrow(1));
//        System.out.println(borrowDao.selectBorrowList());
//        System.out.println(borrowDao.selectBorrowListByUser("admin"));

//        OrderDao orderDao = new OrderDao();
//        Order order = new Order();
//        order.setBookName("三国演义");
//        order.setMoney(100);
//        order.setNumber(2);
//        order.setUsername("admin");
//        System.out.println(orderDao.insertOrder(order));
//        System.out.println(orderDao.selectOrderList());
//        System.out.println(orderDao.selectOrderListByUser("admin"));
//        System.out.println(orderDao.selectByOrderId("LI-1623908220584"));

//
//        UserDao userDao = new UserDao();
//        LoginVO loginVO = new LoginVO("admin", "123456");
//        System.out.println(userDao.login(loginVO));
//        System.out.println(userDao.register(new LoginVO("admin1", "123456")));
//        System.out.println(userDao.selectUserByUserName("admin"));
//        System.out.println(userDao.selectUserList());
//        User user = new User();
//        user.setAge(11);
//        user.setTel("14798794566");
//        user.setTrueName("张三");
//        user.setUsername("admin1");
//        userDao.updateUserInfoByUsername(user);
//        loginVO = new LoginVO("admin1","654321");
//        userDao.updatePasswordByUsername(loginVO);
    }
}
